<?php

include_once "../../models/core.php";
// include_once "../../models/auth.php";
include_once "../../controllers/user/textClass.php";

// echo "haha";

// $uid = $_GET["uid"];
// $token = $_GET["token"];
$textName = $_GET["textName"];

// $auth = new Auth();
// if($auth->verify($uid, $token) == true){
//     // 
//     $text = new Text($conn);
//     $textContent = $text->getText($textName);
//     echo json_encode(array("status" => true, "textContent" => $textContent));
// }else{
//     alert('身份验证失败！！！');
//     echo "<script>window.location.href = '../../views/office/login.html';</script>"; // 身份验证失败,直接去重新登陆吧
// }

// echo "<script>alert('$textName');</script>"; // debug

$text = new Text($conn);
$result = $text->getText($textName);
if($result["status"] == true){
    echo json_encode(array("status" => true, "textContent" => $result["textContent"]));
}else if($result["status"] == false){
    echo json_encode(array("status" => false, "textContent" => $result["textContent"]));
}
